package com.sdy.hospitalguard.web.controller;

import com.sdy.common.model.Response;
import com.sdy.hospitalguard.biz.model.Role;
import com.sdy.hospitalguard.biz.service.RoleService;
import com.sdy.mvc.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cgj
 * @since 2020-06-01
 */
@Slf4j
@RestController
@RequestMapping("/role")
@Api(tags = "角色相关接口")
public class RoleController extends BaseController {
    @Autowired
    private RoleService roleService;

    @GetMapping("/getRole")
    @ApiOperation(value = "获取角色列表(不包含超级管理员)", response = Role.class)
    public Response<List<Role>> getRole() {
        List<Role> roles = roleService.listRole();
        return Response.success(roles);
    }

    @GetMapping("/getRoleAll")
    @ApiOperation(value = "获取角色列表(所有)", response = Role.class)
    public Response<List<Role>> getRoleAll() {
        return Response.success(roleService.list());
    }

}
